<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function setcookie(name,value,expires){
            var str=name+"="+value;
            if(typeof expires =="number"){
                var d =new Date()
                d.setDate(d.getDate()+7);
                str+=";expires="+d
            }
            document.cookie=str
            return str
        }
       var res= setcookie("妮妮","777",4)
        console.log(res)

        
        function getcookie(name){
            var cookie=document.cookie.split("; ")
            for(var i=0;i<cookie.length;i++){
                var cookie_item=cookie[i].split("=")
                // console.log( cookie_item[1]);
                if(cookie_item[0]==name){
                    return cookie_item[1]
                }

            }
            return "123"
        }
        // var res=getcookie("password")
        // console.log(res);
        function removecookie(name){
            setcookie(name,"",-1)
        }
        // removecookie("妮妮")
    </script>
</body>
</html>